<?php echo $this->Html->script('tiny_mce/tiny_mce')?>
<script type="text/javascript">

jQuery(function(){
	function ableDisable(){
		if($('#UserpageMenu').is(':checked'))
			$('#UserpageOrdemMenu').attr('disabled', false);
		else{
			$('#UserpageOrdemMenu').attr('disabled', true);
			$('#UserpageOrdemMenu').val('');
		}
		if($('#UserpageMenuMais').is(':checked'))
			$('#UserpageOrdemMenuMais').attr('disabled', false);
		else{
			$('#UserpageOrdemMenuMais').attr('disabled', true);
			$('#UserpageOrdemMenuMais').val('');
		}
	}

	ableDisable();
	$('#UserpageMenu').change(function(){ableDisable()});
	$('#UserpageMenuMais').change(function(){ableDisable()});
});

tinymce.init({
    selector: "textarea",
    theme: "advanced",
    theme_advanced_buttons1: "bold, italic, underline, strikethrough, |, justifyleft, justifycenter, justifyright, justifyfull, |, styleselect, formatselect, fontselect, fontsizeselect",
    theme_advanced_buttons2: "forecolor, backcolor, |, bullist, numlist, |, outdent, indent, |, undo, redo, |, link, unlink, image, cleanup, help, code",
    theme_advanced_buttons3: "sub, sup",
    language: 'pt',
    width: "740px",
    height: "520px",
    image_advtab: true,
    relative_urls : false,
    templates: [
        {title: 'Test template 1', content: 'Test 1'},
        {title: 'Test template 2', content: 'Test 2'}
    ],
});
</script>
<?php echo $this->Form->create('Userpage'); ?>
<fieldset>
	<legend><?php echo __('Adicionar infopágina'); ?></legend>
<?php
	echo $this->Form->input('titulo', array('label'=>'Título da página - É o texto que vai aparece no menu caso exista', 'errorMessage'));
	echo $this->Form->input('descricao', array('required'=>false, 'label'=>'Descrição da pagina (Apenas para controle do admin)'));
	echo $this->Form->input('texto', array('type'=>'textarea', 'required'=>false));
	echo $this->Form->input('menu', array('type'=>'checkbox', 'label'=>__('Criar entrada no menu superior?')));
	echo $this->Form->input('ordem_menu', array('type'=>'text', 'label'=>__('Ordem no menu (menores valores aparecem primeiro)')));
	echo $this->Form->input('menu_mais', array('type'=>'checkbox', 'label'=>__('Criar entrada no menu Mais?')));
	echo $this->Form->input('ordem_menu_mais', array('type'=>'text', 'label'=>__('Ordem no menu Mais(menores valores aparecem primeiro)')));
?>
</fieldset>
<div class="submit">
	<?php echo $this->Form->submit(__('Gravar'), array('div'=>false, 'class'=>'btn btn-success')); ?>
	<?php echo $this->Html->link(__('Voltar'), array('action' => 'index'), array('class'=>'btn')); ?>
</div>
